package org.example.oauth2.service;

import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * 用户信息拓展
 *
 */
@Getter
public class CustomUserDetails extends User {

	/**
	 * 用户id
	 */
	private final Long userId;

	/**
	 * 第三方认证ID
	 */
	private final String oauthId;
	/**
	 * 昵称
	 */
	private final String name;
	/**
	 * 真名
	 */
	private final String realName;
	/**
	 * 账号
	 */
	private final String account;
	/**
	 * 部门id
	 */
	private final String deptId;
	/**
	 * 角色id
	 */
	private final String roleId;
	/**
	 * 角色名
	 */
	private final String roleName;
	/**
	 * 头像
	 */
	private final String avatar;

	private final String zkToken;

	public CustomUserDetails(Long userId, String oauthId, String name, String realName, String deptId, String roleId, String roleName, String avatar, String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities, String zkToken) {
		super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
		this.userId = userId;

		this.oauthId = oauthId;
		this.name = name;
		this.realName = realName;
		this.account = username;
		this.deptId = deptId;
		this.roleId = roleId;
		this.roleName = roleName;
		this.avatar = avatar;
		this.zkToken=zkToken;
	}



}
